package com.ds.infrastructure.hyperspace.common.config;

import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;

/**
 * @Author: yaozh
 * @Description:
 */
@Getter
public class OpentracingConfig {
    public static final int SAMPLE_RATE_MAX = 10000;
    @Setter
    private String url;
    @Setter
    private boolean enable = true;
    @Setter
    private Integer maxBatchSendSize = Integer.valueOf(2000);
    @Setter
    private Integer maxSendAwaitSeconds = Integer.valueOf(3);

    private Double sampleRate = Double.valueOf(1);

    private Integer sampleRateThreshold = Integer.valueOf(SAMPLE_RATE_MAX);

    public void setSampleRate(Double sampleRate) {
        this.sampleRate = sampleRate;
        this.sampleRateThreshold = new BigDecimal(sampleRate).multiply(new BigDecimal(SAMPLE_RATE_MAX)).intValue();
    }
}
